From 346e3d72e111d60960c3fd79eb7db6f97de97d14 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Thu, 25 Aug 2022 07:18:40 -0600 Subject: [PATCH] use radio buttons for exclusive choice of timespec for track filter start and stop times in GUI. --- gui/filterdata.h | 7 ++++--- gui/filterwidgets.cc | 19 ++++++++++------- gui/trackui.ui | 50 +++++++++++++++++++++++++++++++------------- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/gui/filterdata.h b/gui/filterdata.h index 00071541d..d61201d23 100644 --- a/gui/filterdata.h +++ b/gui/filterdata.h @@ -61,7 +61,7 @@ class TrackFilterData: public FilterData public: TrackFilterData(): title(false), titleString(QString()), move(false), weeks(0), days(0), hours(0), mins(0), secs(0), - TZ(true), + localTime(true), utc(false), start(false), stop(false), pack(false), merge(false), split(false), @@ -96,7 +96,8 @@ public: sg.addVarSetting(new DateTimeSetting("trks.startTime", startTime)); sg.addVarSetting(new BoolSetting("trks.stop", stop)); sg.addVarSetting(new DateTimeSetting("trks.stopTime", stopTime)); - sg.addVarSetting(new BoolSetting("trks.TZ", TZ)); + sg.addVarSetting(new BoolSetting("trks.localTime", localTime)); + sg.addVarSetting(new BoolSetting("trks.utc", utc)); sg.addVarSetting(new BoolSetting("trks.move", move)); sg.addVarSetting(new IntSetting("trks.weeks", weeks)); sg.addVarSetting(new IntSetting("trks.days", days)); @@ -117,7 +118,7 @@ public: QString titleString; bool move; int weeks, days, hours, mins, secs; - bool TZ; + bool localTime, utc; bool start; QDateTime startTime; diff --git a/gui/filterwidgets.cc b/gui/filterwidgets.cc index d6d5aa17b..2e638eae4 100644 --- a/gui/filterwidgets.cc +++ b/gui/filterwidgets.cc @@ -69,7 +69,8 @@ TrackWidget::TrackWidget(QWidget* parent, TrackFilterData& tfd): FilterWidget(pa connect(ui.splitTimeCheck, &QAbstractButton::clicked, this, &TrackWidget::splitTimeX); connect(ui.splitDistanceCheck, &QAbstractButton::clicked, this, &TrackWidget::splitDistanceX); - connect(ui.TZCheck, &QAbstractButton::clicked, this, &TrackWidget::TZX); + connect(ui.localTime, &QAbstractButton::clicked, this, &TrackWidget::TZX); + connect(ui.utc, &QAbstractButton::clicked, this, &TrackWidget::TZX); ui.startEdit->setDisplayFormat("dd MMM yyyy hh:mm:ss AP"); ui.stopEdit->setDisplayFormat("dd MMM yyyy hh:mm:ss AP"); @@ -82,15 +83,16 @@ TrackWidget::TrackWidget(QWidget* parent, TrackFilterData& tfd): FilterWidget(pa // If the two timeSpecs match Qt5 and Qt6 behave the same. ui.startEdit->setTimeSpec(tfd.startTime.timeSpec()); ui.stopEdit->setTimeSpec(tfd.stopTime.timeSpec()); - // Force TZ data to be in sync with startTime & stopTime time spec. - // This makes sure the initial state of the TZCheck box is in agreement - // with the startTime::timeSpec and stopTime::timeSpec. - tfd.TZ = tfd.startTime.timeSpec() == Qt::LocalTime; + // Make sure the initial state of the localTime and utc radio buttons + // is in agreement with the startTime::timeSpec and stopTime::timeSpec. + tfd.localTime = tfd.startTime.timeSpec() == Qt::LocalTime; + tfd.utc = !tfd.localTime; // Collect the data fields. fopts << new BoolFilterOption(tfd.title, ui.titleCheck); fopts << new BoolFilterOption(tfd.move, ui.moveCheck); - fopts << new BoolFilterOption(tfd.TZ, ui.TZCheck); + fopts << new BoolFilterOption(tfd.localTime, ui.localTime); + fopts << new BoolFilterOption(tfd.utc, ui.utc); fopts << new BoolFilterOption(tfd.start, ui.startCheck); fopts << new BoolFilterOption(tfd.stop, ui.stopCheck); fopts << new BoolFilterOption(tfd.pack, ui.packCheck); @@ -124,7 +126,8 @@ TrackWidget::TrackWidget(QWidget* parent, TrackFilterData& tfd): FilterWidget(pa //------------------------------------------------------------------------ void TrackWidget::otherCheckX() { - ui.TZCheck->setEnabled(ui.stopCheck->isChecked() || ui.startCheck->isChecked()); + ui.localTime->setEnabled(ui.stopCheck->isChecked() || ui.startCheck->isChecked()); + ui.utc->setEnabled(ui.stopCheck->isChecked() || ui.startCheck->isChecked()); ui.splitTimeSpin->setEnabled(ui.splitTimeCheck->isChecked()); ui.splitTimeCombo->setEnabled(ui.splitTimeCheck->isChecked()); @@ -184,7 +187,7 @@ void TrackWidget::splitDistanceX() //------------------------------------------------------------------------ void TrackWidget::TZX() { - if (ui.TZCheck->isChecked()) { + if (ui.localTime->isChecked()) { ui.startEdit->setTimeSpec(Qt::LocalTime); ui.stopEdit->setTimeSpec(Qt::LocalTime); } else { diff --git a/gui/trackui.ui b/gui/trackui.ui index 2cbea7971..0fb85cb92 100644 --- a/gui/trackui.ui +++ b/gui/trackui.ui @@ -6,7 +6,7 @@ 0 0 - 663 + 675 270 @@ -220,19 +220,6 @@ This option is used along with the stop to discard trackpoints that were recorde - - - - If checked, time specified here is based on this computer's current time zone. - - - If checked, the times specified here are based on the local computer's time zone. Otherwise it is UTC. - - - Local Time - - - @@ -480,6 +467,38 @@ This option computes (or recomputes) a value for the GPS heading at each trackpo + + + + If checked, times specified here are based on this computer's current time zone. + + + If checked, times specified here are based on this computer's current time zone. + + + Local Time + + + buttonGroup + + + + + + + If checked, times specified here are UTC. + + + If checked, times specified here are UTC. + + + UTC + + + buttonGroup + + + @@ -512,4 +531,7 @@ This option computes (or recomputes) a value for the GPS heading at each trackpo + + + -- 2.30.2